package com.stone.weblog.web.controller;

import com.stone.weblog.common.aspect.ApiOperationLog;
import com.stone.weblog.common.response.Response;
import com.stone.weblog.web.entity.UserEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * @program: weblog-springboot
 * @author: stone
 * @url: 1755545704@qq.com
 * @create: 2024-01-07 23:19
 * @description:
 */
@RestController
@Api("首页模块")
@Slf4j
public class TestController {


    @ApiOperationLog(description = "测试接口")
    @ApiOperation(value = "测试接口")
    @PostMapping("/admin/test")
    public Response test(@RequestBody @Validated UserEntity user){
        user.setCreateTime(LocalDateTime.now());
        user.setUpdateTime(LocalDateTime.now());
        user.setDate(LocalDate.now());
        return Response.success(user);
    }

    @ApiOperationLog(description = "测试接口1")
    @ApiOperation(value = "测试接口1")
    @PostMapping("/test")
    public Response test1(@RequestBody @Validated UserEntity user){
        user.setCreateTime(LocalDateTime.now());
        user.setUpdateTime(LocalDateTime.now());
        user.setDate(LocalDate.now());
        return Response.success(user);
    }
}